import { createApp } from 'vue';
import App from './App.vue';
import router from './router';
import store from './store';
import ElementUI from 'element-plus';
import zhCn from 'element-plus/lib/locale/lang/zh-cn';
import 'dayjs/locale/zh-cn';
import common from '@/lib/common';
import {pHttp} from "@/lib/http/http";
import storage from "@/lib/storage/storage";

import './assets/font-awesome/css/font-awesome.min.css'; // 字体图标

import './assets/scss/element-variables.scss'; // element UI 样式变量
import './assets/scss/public.scss'; // 全局样式
import './lib/http/axios';


// Vue.prototype.$common = common;

// 引入Home页面 菜单样式
const styleArr: any = [
    common.homeTheme() === 0 ? import('./views/app/home/homeClassic/scss/home-classic-menu.scss') : '',
    common.homeTheme() === 1 ? import("./views/app/home/homeWin/scss/home-win-menu.scss") : ''
];

pHttp.Get(`/dictionary`).then((data) => {
    if(data && data.length>0){
        const tem: any = {};
        for (const item of data) {
            tem[item.only_key] = item;
        }
        storage.dictionary.Set(tem);
    }
}).catch((err) => false);

pHttp.Get(`/sys/config`).then((data) => {
    if(data && data.length>0){
        const tem: any = {};
        for (const item of data) {
            tem[item.only_key] = item;
        }
        storage.sysConfig.Set(tem);
    }
}).catch((err) => false);


const app = createApp(App);
app.use(store);
app.use(router);
/**
 * 额外的尺寸：medium、small、mini， 通过设置size属性来配置它们。
 */
app.use(ElementUI, { size: 'small', locale: zhCn });
app.mount('#app');
